home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / displytl / network.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  5.2 KB  |  189 lines

  1. /*
  2.  * Copyright (c) 1990, 1991, 1992 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23. /* $Header: /Source/Media/collab/DisplayTool/RCS/network.c,v 1.2 93/02/07 17:51:48 drapeau Exp $ */
  24. /* $Log:    network.c,v $
  25.  * Revision 1.2  93/02/07  17:51:48  drapeau
  26.  * Fixed a pointer error in GetSelection(), when looking at the label for
  27.  * a newly-initialized slide.
  28.  * 
  29.  * Revision 1.1  92/10/29  13:57:56  drapeau
  30.  * Initial revision
  31.  *  */
  32. static char dtNetwork[] = "$Header: /Source/Media/collab/DisplayTool/RCS/network.c,v 1.2 93/02/07 17:51:48 drapeau Exp $";
  33.  
  34. #include "DisplayTool.h"
  35. #include "externs.h"
  36.  
  37.  
  38. void 
  39.   OpenDoc(char **filename)
  40. {
  41.   char temp[MaxLength];
  42.  
  43.   if ((strcmp(*filename, currentFilename) != 0 &&            /* Check that filename is not 'untitled' or that... */
  44.        strstr(*filename, "untitled") == NULL &&                /* ...it hasn't been loaded already */
  45.        strlen(*filename) > 0) || changes)
  46.     {
  47.       strcpy(currentFilename, *filename);
  48.       sprintf(temp, "DisplayTool Document :  \"%s\"", *filename);
  49.       xv_set(baseWindow->baseWindow, XV_LABEL, temp, NULL);
  50.       performing = 1;
  51.       OpenHandler(*filename, 1);
  52.       performing = 0;
  53.       beginDoubleBuffer = 1;
  54.     }
  55. }
  56.  
  57. void 
  58.   SetSelection(MAESelection *selection)
  59. {
  60.   PrintDTDiagnostics("\n\nEntering SetSelection.\n");
  61.   previousSlide = selectedSlide;
  62.   selectedSlide = selection->start;
  63.   performing = 1;
  64.   DisplayImages(selection->start);
  65.   PrepareMultipleWindowsForDisplay(selectedSlide);
  66.   performing = 0;
  67. }
  68.  
  69. void 
  70.   PerformSelection(void)
  71. {
  72.   int    i;
  73.   
  74.   sprintf(diagString, "PerformSelection, performing slide %d\n", selectedSlide);
  75.   PrintDTDiagnostics(diagString);
  76.   performing = 1;
  77.   if (strncmp(slide[selectedSlide]->duration, "Indefinite", 10))
  78.     notify_set_itimer_func((Notify_client)baseWindow->baseWindow, IncrementCounter, 
  79.                ITIMER_REAL, &timer, NULL);
  80.   KillOldPopupsOnly();
  81.   if (previousSlide != selectedSlide)
  82.   {
  83.     sprintf(diagString, "In PerformSelection, about to free memory for slide %d (current slide is %d).\n",
  84.         previousSlide, selectedSlide);
  85.     PrintDTDiagnostics(diagString);
  86.     FreeMemoryForSlide(previousSlide);
  87.   }
  88.   DisplayMultipleWindows(selectedSlide);
  89.   for (i = 0; i < popupTot; i++)                    /* Copy information from newly-created Popups & Canvases */
  90.   {
  91.     oldPopups[i] = globalPopup[i];
  92.     oldCanvases[i] = globalCanvas[i];
  93.   }
  94.   oldPopupTot = popupTot;
  95.   performing = 0;
  96. }                                    /* end function PerformSelection */
  97.  
  98.  
  99.  
  100. char **
  101.   GetDoc(void *unusedArg)
  102. {
  103.   if (strlen(currentFilename) == 0 || realpath(currentFilename, canonFilename) == NULL) 
  104.     strcpy(canonFilename, "untitled");
  105.   return (&canonFilename);
  106. }
  107.  
  108. MAESelection *
  109.   GetSelection(void *unusedArg)
  110. {
  111.   static MAESelection select;
  112.   if (selectedSlide >= 0 && selectedSlide<MaxNumSlides)
  113.     {
  114.       select.offset = 0;
  115.       sprintf(select.label, "%s", slide[selectedSlide]->label);
  116.       select.start = selectedSlide;
  117.       select.end = selectedSlide;
  118.       if (strncmp(slide[selectedSlide]->duration, "Indefinite", 10))
  119.     select.duration = 1000*atoi(slide[selectedSlide]->duration);   
  120.       else 
  121.     select.duration = 0;
  122.     }
  123.   else 
  124.     {
  125.       select.duration = -1;
  126.       select.start = -1;
  127.       select.end = -1;
  128.       select.offset = 0;
  129.       sprintf(select.label, "No Label");
  130.     }
  131.   return (&select);
  132. }
  133.  
  134. void 
  135.   HaltSelection(void)
  136. {
  137.   pauseMode = 0;
  138.   KillPopups();
  139.   performing = 0;
  140. }
  141.  
  142. void 
  143.   PauseSelection(void)
  144. {
  145.   pauseMode = 1;
  146.   return;
  147. }
  148.  
  149. void 
  150.   ResumeSelection(void)
  151. {
  152.   pauseMode = 0;
  153.   return;
  154. }
  155.  
  156.  
  157. void 
  158.   HideApplication(void)
  159. {
  160.   xv_set(baseWindow->baseWindow, FRAME_CLOSED, TRUE, NULL);
  161.   XFlush(display);
  162. }
  163.  
  164. void 
  165.   ShowApplication(void)
  166. {
  167.   xv_set(baseWindow->baseWindow, FRAME_CLOSED, FALSE, NULL); 
  168.   XRaiseWindow(display, (Window)xv_get(baseWindow->baseWindow, XV_XID));
  169.   XFlush(display);
  170. }
  171.  
  172. IconData *
  173.   GetAppIcon(void)
  174. {
  175.   static int first = True;
  176.   static unsigned short baseWindow_bits[] = {
  177. #include "DisplayTool.icon"
  178.   };
  179.   if (first)
  180.     {
  181.       iconData.iconData = (char *)malloc(sizeof(baseWindow_bits));
  182.       bcopy(baseWindow_bits, iconData.iconData, sizeof(baseWindow_bits));
  183.       if (iconData.iconData)
  184.     iconData.dataLength = sizeof(baseWindow_bits);
  185.       first = False;
  186.     }
  187.   return(&iconData);
  188. }                                    /* end function GetAppIcon */
  189.